package com.dower.clothing.service.impl;

import java.util.List;

import com.dower.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dower.clothing.mapper.FinaPurchaseGoodsMapper;
import com.dower.clothing.domain.FinaPurchaseGoods;
import com.dower.clothing.service.IFinaPurchaseGoodsService;
import com.dower.common.core.text.Convert;

/**
 * 进货商品Service业务层处理
 * 
 * @author dower
 * @date 2020-09-02
 */
@Service
public class FinaPurchaseGoodsServiceImpl implements IFinaPurchaseGoodsService 
{
    @Autowired
    private FinaPurchaseGoodsMapper finaPurchaseGoodsMapper;

    /**
     * 查询进货商品
     * 
     * @param purchaseGoodsId 进货商品ID
     * @return 进货商品
     */
    @Override
    public FinaPurchaseGoods selectFinaPurchaseGoodsById(Long purchaseGoodsId)
    {
        return finaPurchaseGoodsMapper.selectFinaPurchaseGoodsById(purchaseGoodsId);
    }

    /**
     * 查询进货商品列表
     * 
     * @param finaPurchaseGoods 进货商品
     * @return 进货商品
     */
    @Override
    public List<FinaPurchaseGoods> selectFinaPurchaseGoodsList(FinaPurchaseGoods finaPurchaseGoods)
    {
        return finaPurchaseGoodsMapper.selectFinaPurchaseGoodsList(finaPurchaseGoods);
    }

    /**
     * 新增进货商品
     * 
     * @param finaPurchaseGoods 进货商品
     * @return 结果
     */
    @Override
    public int insertFinaPurchaseGoods(FinaPurchaseGoods finaPurchaseGoods)
    {
        finaPurchaseGoods.setCreateTime(DateUtils.getNowDate());
        return finaPurchaseGoodsMapper.insertFinaPurchaseGoods(finaPurchaseGoods);
    }

    /**
     * 修改进货商品
     * 
     * @param finaPurchaseGoods 进货商品
     * @return 结果
     */
    @Override
    public int updateFinaPurchaseGoods(FinaPurchaseGoods finaPurchaseGoods)
    {
        finaPurchaseGoods.setUpdateTime(DateUtils.getNowDate());
        return finaPurchaseGoodsMapper.updateFinaPurchaseGoods(finaPurchaseGoods);
    }

    /**
     * 删除进货商品对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteFinaPurchaseGoodsByIds(String ids)
    {
        return finaPurchaseGoodsMapper.deleteFinaPurchaseGoodsByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除进货商品信息
     * 
     * @param purchaseGoodsId 进货商品ID
     * @return 结果
     */
    @Override
    public int deleteFinaPurchaseGoodsById(Long purchaseGoodsId)
    {
        return finaPurchaseGoodsMapper.deleteFinaPurchaseGoodsById(purchaseGoodsId);
    }
}
